home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MPW C++ / MPW C++ 3.1 / Examples / CPlusExamples / ShapesDocument.h < prev    next >
Text File  |  1990-09-11  |  3KB  |  99 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    MultiFinder-Aware Simple Shapes Sample Application
  4. #
  5. #    CPlusShapesApp
  6. #
  7. #    This file: ShapesDocument.h    -    Interface to the TShapesDocument Class 
  8. #
  9. #    Copyright © 1988 Apple Computer, Inc.
  10. #    All rights reserved.
  11. #
  12. #    Versions:    1.0                 3/89
  13. #
  14. #    Components:
  15. #            CPlusShapesApp.make        March 1, 1989
  16. #            TApplicationCommon.h    March 1, 1989
  17. #            TApplication.h            March 1, 1989
  18. #            TDocument.h                March 1, 1989
  19. #            ShapesAppCommon.h        March 1, 1989
  20. #            ShapesApp.h                March 1, 1989
  21. #            ShapesDocument.h        March 1, 1989
  22. #            TApplication.cp            March 1, 1989
  23. #            TDocument.cp            March 1, 1989
  24. #            ShapesApp.cp            March 1, 1989
  25. #            ShapesDocument.cp        March 1, 1989
  26. #            TApplication.r            March 1, 1989
  27. #            ShapesApp.r                March 1, 1989
  28. #
  29. #   There are four main classes in this program. Each of
  30. #   these classes has a definition (.h) file and an
  31. #   implementation (.cp) file.  
  32. #   
  33. #   The TApplication class does all of the basic event
  34. #   handling and initialization necessary for Mac Toolbox
  35. #   applications. It maintains a list of TDocument objects,
  36. #   and passes events to the correct TDocument class when
  37. #   apropriate. 
  38. #   
  39. #   The TDocument class does all of the basic document
  40. #   handling work. TDocuments are objects that are
  41. #   associated with a window. Methods are provided to deal
  42. #   with update, activate, mouse-click, key down, and other
  43. #   events. Some additional classes which implement a
  44. #   linked list of TDocument objects are provided. 
  45. #   
  46. #   The TApplication and TDocument classes together define
  47. #   a basic framework for Mac applications, without having
  48. #   any specific knowledge about the type of data being
  49. #   displayed by the application's documents. They are a
  50. #   (very) crude implementation of the MacApp application
  51. #   model, without the sophisticated view heirarchies or
  52. #   any real error handling. 
  53. #   
  54. #   The TShapesApp class is a subclass of TApplication. It
  55. #   overrides several TApplication methods, including those
  56. #   for handling menu commands and cursor adjustment, and
  57. #   it does some necessary initialization.
  58. #   
  59. #   The TShapesDocument class is a subclass of TDocument. This
  60. #   class contains most of the special purpose code for
  61. #   shape drawing. In addition to overriding several of the
  62. #   TDocument methods, it defines a few additional
  63. #   methods which are used by the TShapesApp class to get
  64. #   information on the document state.  
  65. #
  66. #------------------------------------------------------------------------------*/
  67.  
  68. #ifndef ShapeDocument_Defs
  69. #define ShapeDocument_Defs
  70.  
  71. #include <Types.h>
  72. #include <TextEdit.h>
  73. #include <Controls.h>
  74. #include <Events.h>
  75.  
  76. #include "TDocument.h"
  77. #include "Shapes.h"
  78.  
  79. class TShapesDocument : public TDocument {
  80.     // internal fields
  81.     TShape *fShapeObj;
  82.  
  83.     // methods not intended for use outside of methods of this class
  84.     void DrawWindow(void);
  85.  
  86.   public:
  87.     TShapesDocument(short resID);
  88.     ~TShapesDocument(void);
  89.  
  90.     void ChangeShape(int newShape);
  91.     Boolean HasShape(void) {return (fShapeObj != nil);}
  92.     TShape *GetShape(void) {return (fShapeObj);}
  93.     
  94.     // methods from TDocument we override
  95.     void DoUpdate(void);
  96. };
  97.  
  98. #endif ShapeDocument_Defs
  99.